home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / AIncludes / Components.a < prev    next >
Encoding:
Text File  |  1993-12-02  |  8.3 KB  |  159 lines  |  [TEXT/MPS ]

  1. ;___________________________________________________________________________
  2. ; Created: Wednesday, April 21, 1993
  3. ; Modified: Tue, Nov 30, 1993 01:14:58
  4. ;
  5. ; File: Components.a
  6. ;
  7. ; Assembler Interface to the Macintosh Libraries
  8. ; Copyright Apple Computer, Inc. 1990-93
  9. ; All Rights Reserved
  10. ;
  11. ;___________________________________________________________________________
  12.  
  13.  IF &TYPE('__INCLUDINGCOMPONENTS__') = 'UNDEFINED' THEN
  14. __INCLUDINGCOMPONENTS__   SET 1
  15.  
  16.  IF &TYPE('__INCLUDINGTRAPS__') = 'UNDEFINED' THEN
  17.  INCLUDE 'Traps.a'
  18.  ENDIF
  19.  
  20.  IF &TYPE('gestaltComponentMgr') = 'UNDEFINED' THEN
  21. gestaltComponentMgr                               EQU      'cpnt'
  22.  ENDIF
  23.  
  24. kAnyComponentType                                  EQU        0
  25. kAnyComponentSubType                              EQU        0
  26. kAnyComponentManufacturer                          EQU        0
  27. kAnyComponentFlagsMask                              EQU        0
  28.  
  29. cmpWantsRegisterMessage                              EQU      $80000000
  30.  
  31. ;Component Resource Extension flags
  32. componentDoAutoVersion                 EQU     1
  33. componentWantsUnregister            EQU     2
  34. componentAutoVersionIncludeFlags    EQU        4
  35.  
  36. ComponentDescription                              RECORD   0
  37. componentType                                     DS.L       1                       ; A unique 4-byte code indentifying the command set 
  38. componentSubType                                  DS.L       1                       ; Particular flavor of this instance 
  39. componentManufacturer                             DS.L       1                       ; Vendor indentification 
  40. componentFlags                                    DS.L       1                       ; 8 each for Component,Type,SubType,Manuf/revision 
  41. componentFlagsMask                                DS.L       1                       ; Mask for specifying which flags to consider in search, zero during registration 
  42. size                                              EQU      *
  43.                                                   ENDR
  44.  
  45. ResourceSpec                                      RECORD   0
  46. resType                                           DS.L       1                         ; 4-byte code  
  47. resId                                             DS.W       1
  48. size                                              EQU      *
  49.                                                   ENDR
  50.  
  51. ComponentResource                                 RECORD   0
  52. cd                                                DS       ComponentDescription     ; Registration parameters 
  53. component                                         DS       ResourceSpec             ; resource where Component code is found 
  54. componentName                                     DS       ResourceSpec             ; name string resource 
  55. componentInfo                                     DS       ResourceSpec             ; info string resource 
  56. componentIcon                                     DS       ResourceSpec             ; icon resource 
  57. size                                              EQU      *
  58.                                                   ENDR
  59.                                                   
  60. ComponentResourceExtension                        RECORD    0
  61. componentVersion                                DS.L    1            ; version of Component 
  62. componentRegisterFlags                            DS.L    1            ; flags for registration 
  63. componentIconSuite                                DS.W    1            ; resource id of Icon Suite 
  64. size                                            EQU        *
  65.                                                 ENDR
  66.  
  67. ; Structure received by Component:  
  68. ComponentParameters                               RECORD   0
  69. flags                                             DS.B     1                           ; call modifiers: sync/async, deferred, immed, etc 
  70. paramSize                                         DS.B     1                           ; size in bytes of actual parameters passed to this call 
  71. what                                              DS.W       1                        ; routine selector, negative for Component management calls 
  72. params                                            DS.L     1                        ; actual parameters for the indicated routine 
  73. size                                              EQU      *
  74.                                                   ENDR
  75.  
  76.  
  77.  
  78. ;*******************************************************
  79. ;*                                                     *
  80. ;*              APPLICATION LEVEL CALLS                *
  81. ;*                                                     *
  82. ;*******************************************************
  83. ;* Component Instance Allocation and dispatch routines 
  84. ;*******************************************************
  85.  
  86. ; direct calls to the Components 
  87.                                                   MACRO
  88.                                                   _ComponentFunctionImplemented
  89.                                                   MOVE.L       #$0002FFFD,-(A7)
  90.                                                   MOVEQ        #$00,D0
  91.                                                   DC.W         $A82A      ; TB 002A
  92.                                                   ENDM
  93.  
  94.                                                   MACRO
  95.                                                   _GetComponentVersion
  96.                                                   MOVE.L       #$0000FFFC,-(A7)
  97.                                                   MOVEQ        #$00,D0
  98.                                                   DC.W         $A82A      ; TB 002A
  99.                                                   ENDM
  100.  
  101. ;****************************************************
  102. ;*                                                    *
  103. ;*               CALLS MADE BY Components             *
  104. ;*                                                    *
  105. ;******************************************************
  106. ;******************************************************
  107. ;* Required Component routines
  108. ;******************************************************
  109. kComponentOpenSelect                              EQU      -1                       ; ComponentInstance for this open 
  110. kComponentCloseSelect                             EQU      -2                       ; ComponentInstance for this close 
  111. kComponentCanDoSelect                             EQU      -3                       ; selector # being queried 
  112. kComponentVersionSelect                           EQU      -4                       ; no params 
  113. kComponentRegisterSelect                          EQU      -5                       ; no params 
  114. kComponentTargetSelect                            EQU      -6                       ; ComponentInstance for top of call chain 
  115. kComponentUnregisterSelect                           EQU        -7                        ; no params 
  116.  
  117. ;*******************************************************
  118. ;* Component Instance Management routines
  119. ;*******************************************************
  120.  
  121. ; useful helper routines for convenient method dispatching 
  122.                                                   MACRO
  123.                                                   _CallComponentFunction
  124.                                                   MOVEQ        #$FF,D0
  125.                                                   DC.W         $A82A      ; TB 002A
  126.                                                   ENDM
  127.  
  128.                                                   MACRO
  129.                                                   _CallComponentFunctionWithStorage
  130.                                                   MOVEQ        #$FF,D0
  131.                                                   DC.W         $A82A      ; TB 002A
  132.                                                   ENDM
  133.  
  134. ; Set Default Component flags 
  135. defaultComponentIdentical                         EQU      0
  136. defaultComponentAnyFlags                          EQU      1
  137. defaultComponentAnyManufacturer                   EQU      2
  138. defaultComponentAnySubType                        EQU      4
  139. defaultComponentAnyFlagsAnyManufacturer           EQU      defaultComponentAnyFlags+defaultComponentAnyManufacturer
  140. defaultComponentAnyFlagsAnyManufacturerAnySubType EQU      defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
  141.  
  142.                                                   MACRO
  143.                                                   _GetComponentIconSuite
  144.                                                   MOVEQ        #$2A,D0
  145.                                                   DC.W         $A82A      ; TB 002A
  146.                                                   ENDM
  147.  
  148.  
  149. ; errors from component manager & components
  150. invalidComponentID                                  EQU        -3000
  151. validInstancesExist                                  EQU        -3001
  152. componentNotCaptured                              EQU        -3002
  153. componentDontRegister                              EQU        -3003
  154.  
  155. badComponentInstance                              EQU        $80008001
  156. badComponentSelector                              EQU        $80008002
  157.  
  158.  
  159.                                                   ENDIF    ;   ...already included